Each quest record contains the following fields:
1) Quest id: used for referencing quests in other files. The prefix qst_ is automatically added before each quest-id.
2) Quest Name: Name displayed in the quest screen.
3) Quest flags. See header_quests.py for a list of available flags.
4) Quest Description: Description displayed in the quest screen.
Note that you may call the opcode setup_quest_text for setting up the name and description
module_quests.py is a small, simple file. It contains quests, including all the text related to those quests. Putting new quests here allows them to be activated via the module system, so that operations can read the quest's current status and use that status as a condition operation. It also defines a quest object, for which the aforementioned slots can be used. Example of a quest:
("deliver_message", "Deliver Message to {s13}", qf_random_quest,
"{!}{s9} asked you to take a message to {s13}. {s13} was at {s4} when you were given this quest."
),
This quest is one of many generic delivery request a king may give you.[1] Tuple breakdown:
1) Quest id = "deliver_message"
2) Quest Name = "Deliver Message"
3) Quest flags = qf_random_quest
4) Quest Description = "{s9} asked you to take a message to {s13}. {s13} was at {s4} when you were given this quest."
This quest uses string registers ({s9}, {s13}, and {s4}) to indicate who gave the quest({s9}), the recipient ({s13}), and where the target was last seen ({s4}). Looking at similar quests, it would seem that {s9} is always used as the requester's name, {s13} is the intended target troop/party and {s4} is used as their last location.
In the progress of creating a new quest, you will be using some of the in section Module Contants mentioned slots for your quest. This way, the value can be set in one place, and if it needs to be changed you only need to change it in one place. The other benefit is that if the player has more than one quest active, you don't have to worry that you might be over-writing variables we defined. Each quest (like all tuple objects) has its own slots.
You will quickly notice that it takes only a few changes to make a new quest, but incorporating it into the game requires a lot more work. You need a place for the player to get the quest, the "actors" that will play a part in the quest and some dialog to make it interesting.
If you wish to make a quest without any flags, simply put a 0 in the flags field. Otherwise you have the following two available:
qf_show_progression | shows what percentage of this quest is completed. |
qf_random_quest | determines that this quest is a random one. |
Here is the bare-bones way to create new quests with MABL. First, you need a consequence block (at the end of a dialogue line, for example) that begins your quest, such as this one:
[[assign,"$do_stuff_quest_active",1],
[setup_quest_text,"qst_do_stuff"],
[start_quest,"qst_do_stuff"]]],
You can use this kind of consequence block in module_dialogs.py, module_game_menus.py and module_triggers.py (and in others probably as well).
Next, you have to input your quest text at the bottom of module_quests.py:
("do_stuff", "Do some really amazing stuff", qf_show_progression,
"Some guy asked you to do some really amazing stuff, and he'll give you some gold."
),
Having done this, input whatever content (dialogue, fights and so on) you want this quest to have.
With everything else done the time has come to close your quest:
[[add_xp_as_reward,100],
[complete_quest,"do_stuff"],
[set_quest_progression,"qst_do_some_more_stuff",40],
[assign,"$quest_succeeded_do stuff",1]]],
This is all you need for a basic quest. More complex ones will require more complicated finagling, especially quests involving heroes.
quests and slots (also later messages at that page), Khamukkamu and kalarhan, Modding Q&A
quests, kalarhan, Modding Q&A